package com.unisal.java;

import java.util.Iterator;

public class Garconete {

	Menu menuDePanquecas;
	Menu menuJantar;
	Menu menuCafe;
	
	public Garconete(Menu menuDePanquecas, Menu menuJantar, Menu menuCafe) {
		this.menuDePanquecas = menuDePanquecas;
		this.menuJantar = menuJantar;
		this.menuCafe = menuCafe;
	}
	
	public void imprimeMenu(){
		Iterator<ItemDoMenu> paquecaIterator = menuDePanquecas.criaIterator();
		Iterator<ItemDoMenu> jantarIterator = menuJantar.criaIterator();
		Iterator<ItemDoMenu> cafeIterator  = menuCafe.criaIterator();
 		
		System.out.println("MENU\n----\nCafe da Manha");
		printMenu(paquecaIterator);
		System.out.println();
		System.out.println("MENU\n----\nJantar");
		printMenu(jantarIterator);
		System.out.println();
		System.out.println("MENU\n----\nCafe");
		printMenu(cafeIterator);
	}

	private void printMenu(Iterator<ItemDoMenu> iterator) {
		while(iterator.hasNext()){
			ItemDoMenu item = (ItemDoMenu) iterator.next();
			System.out.print(item.getNome() + " ");
			System.out.print(item.getPreco() + " \n    ");
			System.out.println(item.getDescricao());
		}
		
	}
}
